pub fn odd_fibnacci_sum(threshold: u32) -> u32 {
    let fibonacci = generate_fibonacci(threshold);
    let mut sum = 0;
    for num in fibonacci {
        if num % 2 == 1 {
            sum += num;
        }
    }
    sum
}

fn generate_fibonacci(n: u32) -> Vec<u32> {
    let mut fibonacci = vec![0, 1];
    loop {
        let next = fibonacci[fibonacci.len() - 1] + fibonacci[fibonacci.len() - 2];
        if next > n {
            break;
        }
        fibonacci.push(next);
    }
    fibonacci
}
